#include "mod_perseus.h"



int perseus_mutex_on(server_rec *s)
{
    perseus_config *c = mySrvConfig(s);
    apr_status_t rv;
    rv = apr_global_mutex_lock(c->pMutex);

    if (rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_WARNING, rv, s,
                "Failed to acquire global mutex lock");
        return 0;
    }
    return 1;
}

int perseus_mutex_off(server_rec *s)
{
    perseus_config *c = mySrvConfig(s);
    apr_status_t rv;
    rv = apr_global_mutex_unlock(c->pMutex);
    if ( rv != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_WARNING, rv, s,
                "Failed to release global mutex lock");
        return 0;
    }
    return 1;
}
